/**
 * 
 */
$(document).ready(function() {
    initListe();
	
	$(".listeMotSound").click(function(){
		chosenWord = $(this).attr("id");
		playSound();
	});
});

function initListe(){
	var divCollaspibles = "";
    for(word in words){
    	divCollaspibles += "<div data-role=\"collapsible\"><h3>"+
    	words[word].name +
    	"</h3><img src=\""+
    	words[word].image_src +
    	"\" class=\"itemImageList\"></img>" +
    	"<a class=\"listeMotSound\" data-role=\"button\" data-theme=\"b\" id=\"" +
    	word +
    	"\">Ecouter !</a></div>";
    }
	$("#listWords [data-role=\"content\"]").append(
			"<div data-role=\"collapsible-set\" data-theme=\"c\" data-content-theme=\"d\">"+
			divCollaspibles +
			"</div>"
	);
}
